<template>
  <div class="container">
    <xy-table :columns="columns" :api="api" :queryColumn="`merchantName`">
      <template #addItem> <span></span></template>

      <template #appendButton="{ row }">
        <template v-if="row.FilePathUrl">
          <el-button
            type="text"
            size="mini"
            circle
            @click="downloadAgreement(row)"
          >
            {{ $language.local("下载协议") }}
          </el-button>
        </template>
        <span v-else hidden></span>
      </template>
    </xy-table>
  </div>
</template>

<script>
import API from "../../plugins/api";

export default {
  created() {},
  data() {
    return {
      api: new API("/api/employeeCredit/"),
      columns: {
        customerName: "客户",
        EMPNAME: "李孝正",
        IDCARDNO: "身份证号",
        // MerchantName: "代理商",
        MonthCanAcceptanceAmount: "可收单金额",
        MonthAcceptanceAmount: "本月收单金额",
        MonthAcceptanceMaxAmount: "本月收单余额",
        YearAcceptanceAmount: "本年收单金额",
        YearAcceptanceMaxAmount: "本年收单余额",
        // Ctime: "创建时间",
        // Status: "状态",
        // BeginTime: "",
        // EndTime: "",
        // ServiceName: "湖南易捷云科技有限公司",
        // ServicePhone: "",
        // SignNo: "P2102240001",
        // USCC: "企业统一信用代码",
        // SignDate: "",
        // ServiceContent: "设计服务",
        // verifysignstatus: 0,
      },
    };
  },
  methods: {
    downloadAgreement(e) {
      console.log(e);
      if (e.FilePathUrl) {
        // window.location.href = this.$http.baseUrl + e.SignName;
        const ele = document.createElement("a");
        ele.setAttribute("href", this.$http.baseUrl + e.FilePathUrl); // 设置下载文件的url地址
        // ele.setAttribute("download", "download"); // 用于设置下载文件的文件名
        ele.click();
      }
    },
  },
};
</script>

<style></style>
